<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page pageEncoding="UTF-8" %>
<%@ include file="../common/common.jsp"%>
<%@ page import="jp.co.technotree.apl.cmd.master.Mst6000Bean" %>
<%@ page import="jp.co.technotree.apl.api.common.Message,jp.co.technotree.common.ApplicationManager" %>
<jsp:useBean id="formBean" class="jp.co.technotree.apl.cmd.master.Mst6000Bean" scope="request" />
<%
	Mst6000Bean.Record[] recordList = formBean.getRecordList();
	Mst6000Bean.SysVal1Menu[] sysVal1List = formBean.getSysVal1List();

//--------------------------------------------ページングＳＴＡＲＴ------------------------------------------------------------------------
	Mst6000Bean.PagerData[] pagerDataList = formBean.getPagerDataList();

	int nowPageNo = formBean.getPageNo();


	//初期ページが0になっていたら1にする
	if(nowPageNo == 0){
		nowPageNo = 1;
	}

	int prevPageNo = nowPageNo - 1;
	int nextPageNo = nowPageNo + 1;

	int stPage = 1;
	int edPage = 0;


	if(pagerDataList != null){
		edPage = pagerDataList.length;
	}

	int startLoopNum = formBean.getStartLoopNum();
	int endLoopNum = formBean.getEndLoopNum();
	int sideNum = 5;

	boolean isPrev = (nowPageNo != stPage);
	boolean isNext = (nowPageNo != edPage);
	boolean isMinPrev = (nowPageNo - sideNum > stPage);
	boolean isMaxNext = (nowPageNo + sideNum < edPage);
	//--------------------------------------------ページングＥＮＤ------------------------------------------------------------------------

%>
<html>
	<head>
		<title>予備品管理システム - 基準値情報一覧画面</title>
		<link rel="SHORTCUT ICON" href="../common/img/default/sys_icon.ico">

		<link rel='stylesheet' type='text/css' href='../../common/css/common/base.css' >
		<link rel='stylesheet' type='text/css' href='../../common/css/common/common.css'>
		<link rel='stylesheet' type='text/css' href='../../common/css/master/mst6000.css'>

		<script language="javascript" src="../../common/js/base.js"></script>
		<script language="javascript" src="../../common/js/menu/topmenu.js"></script>

		<!--ポップアップ用-->
		<link rel='stylesheet' type='text/css' href='../../common/css/popUpPc.css' >
		<script type='text/javascript' src='../../common/js/popUpPc.js'></script>

		<!-- システムログ -->
		<script src="../../common/js/systemlog.js"></script>

		<style type='text/css'>
			.LinkItem {
				cursor: pointer;
			}
			.div-wid {
				border-bottom:solid 1px #ccc;
				width:1160px; /* 横幅合計 + スクロールバー分 */
				height:400px;
				overflow:auto;
			}
		</style>

		<script language="javascript">
			function onInit(){
				//topBackChange(0);
				//httpRequest();
			}
			function screen_back() {
				//location.href="../topmenu/top1000";
				nextPageJump("topmenu1000");
			}
			//新規登録
			function insertSerch(dataId3){
				//location.href="../mst7000/mst7000";
				var sysId = document.getElementById("findSysId").value;
				if(sysId == ""){
					// 管理値が選択されていません
					alert_Custom("<%=Message.getMessage("WRN00011").replace("$1", "管理値")%>");
					return;
				}
				document.getElementById("dataId3").value = dataId3;
				nextPageJump("mst7000");
			}
			//変更
			function updateSerch(dataId1, dataId2) {
				//location.href="../mst7000/mst7000?outputCate=2&keyValId="+valId+"&keySysId="+sysId;
				document.getElementById("dataId1").value = dataId1;
				document.getElementById("dataId2").value = dataId2;
				nextPageJump("mst7000");
			}
			function nextPageJump(nextPage){

				mainForm = document.getElementById("F1");
				document.getElementById("nextPage").value = nextPage;

				mainForm.submit();
			}

			//ページングリンクを押したときの処理
			function wzdPager(pageNo) {
				var frm = document.forms["main"];

				frm.pageNo.value=pageNo;
				frm.submitFlag.value="1";
				frm.cmd.value='cmd01';
				frm.submit();

			}
			//システム管理値検索
			function formSubmit() {
				var frm = document.main;
				frm.cmd.value = "cmd01";
				frm.submitFlag.value = "1";
				frm.submit();
			}

			//-------------------------------------------------------------------------
			//<!-- ポップアップ START -->

			//パップアップ解除
			function back(){
				document.getElementById("opAlertBtn").style.display = "none";
				document.getElementById("opAlert").style.display = "none";
				document.getElementById("opAlertButton").style.display = "none";
				document.getElementById("opAlertTop").style.display = "none";
				document.getElementById("allbackgr").style.display = "none";
			}

			//<!-- ポップアップ END -->
			//-------------------------------------------------------------------------

		</script>

	</head>

	<body onLoad="onInit()" style="margin: 0px 4px 0px 0px;">
		<form class="frmMain" name="main" id="F1" action="./mst6000" method="post" enctype="multipart/form-data" onsubmit="return false;">
			<table class="tblMain" width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td valign="top">
						<table class='main-width-tb'  cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>
						<table class='main-height-tb' cellspacing='0' cellpadding='0' border='0'><tr><td></td></tr></table>

						<!-- Header Menu START -->
						<div class="header-title">予備品管理システム(<%=formBean.kojou%>)</div>
						<!-- Header Menu END -->

						<!-- ***** [FORM] MAIN-FORM ***** -->
						<div id="lc-out" style="z-index: 0;">
							<div id="lc-in" style="z-index: 0">

								<div class="subtitle">基準値情報一覧画面</div>
								<table  border="0" style="width: 98%;">
									<tr>
										<td>
											<table border="0" style="margin-left: 100px; width:1140px;">
												<tr>
													<td>管理値</td>
													<td>
														<select id="findSysId" name="findSysId" class="selectStyle" style="width:300px;" onchange="formSubmit();">
														<option value="">選択▼</option>
														<%for (int i=0; sysVal1List!=null && i<sysVal1List.length; i++) {%>
														<option value="<%=sysVal1List[i].SysId%>" <%=(formBean.getFindSysId().equals(sysVal1List[i].SysId)) ? " selected " : "" %>><%=sysVal1List[i].SysNm%></option>
														<%}%>
														</select>
													</td>
													<td class="txtright">
														<input type="image" src="../../common/img/pc/btn_new_insert_off.png" onclick="insertSerch('<%=formBean.getFindSysId() %>')" alt="新規登録">
														&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
														<input type="image" src="../../common/img/pc/btn_back_off.png" onclick="screen_back()">
													</td>
												</tr>
												<!-- スペース -->
												<tr style="height: 20px;"><td></td></tr>
											</table>
										</td>
									</tr>
								</table>
							</div>
							<div id="lc-in_under" style="z-index: 0">
								<!-- スペース -->
								<table style="height:20px;"><tr><td></td></tr></table>
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::ページング START:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

<%
int recordCount = 0;
if (recordList != null) {
	recordCount = recordList.length;
}
if ("1".equals(formBean.getSubmitFlag())&& recordCount > 0) {
%>
				<table id="tblPager" width="" align="center" >
					<tr align="left">
						<td id="tblPager2" align="right" width="">
				<%
					if(isMinPrev){
				%>
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= stPage %>);"><<<</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="right" width="">
				<%
					if(isPrev){
				%>
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= prevPageNo %>);">前へ</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="center" width="">
				<%
					for(int i=startLoopNum;i<endLoopNum;i++){
						Mst6000Bean.PagerData pageData = pagerDataList[i];

						if(nowPageNo == pageData.Page){
				%>
							&nbsp;<span id="pagerLinkBorder"><a id="pagerLink" name="<%= pageData.Page %>" href="javascript:wzdPager(<%= pageData.Page %>);"><%= pageData.Page %></a></span>&nbsp;
				<%
						}else{
				%>
							&nbsp;<span id="pagerBtnLinkBorder"><a id="pagerBtnLink" href="javascript:wzdPager(<%= pageData.Page %>);"><%= pageData.Page %></a></span>&nbsp;
				<%
						}
					}
				%>
						</td>

						<td id="tblPager2" align="left" width="">
				<%
					if(isNext){
				%>
&nbsp;&nbsp;&nbsp;&nbsp;
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= nextPageNo %>);">次へ</a>
				<%
					}
				%>
						</td>
						<td id="tblPager2" align="left" width="">
				<%
					if(isMaxNext){
				%>
&nbsp;&nbsp;&nbsp;&nbsp;
							<a id="pagerBtnLinkNoBorder" href="javascript:wzdPager(<%= edPage %>);">>>></a>
				<%
					}
				%>
						</td>
					</tr>
				</table><br>
	<%}
 %>

<!-- :::::::::::::::::::::::::::::::::::::::::::::::ページング END:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->


								<!-- システム基準値一覧 -->
								<div  style="margin: 20px 20px 0px 100px; width: 1140px;">
									<table  border="0" style="width: 90%;">
										<tr>
											<td>
												<table  border="1" width="1140px" height="30px" class="data-grid" >
													<thead>
														<tr>
															<th class="TblField1" style="background-color: #CAE1FF;">&nbsp;</th>
															<th class="TblField2" style="background-color: #CAE1FF;">ID</th>
															<th class="TblField3" style="background-color: #CAE1FF;">値1</th>
															<th class="TblField4" style="background-color: #CAE1FF;">値2</th>
															<th class="TblField5" style="background-color: #CAE1FF;">値3</th>
															<th class="TblField6" style="background-color: #CAE1FF;">並び順</th>
															<th class="TblField7" style="background-color: #CAE1FF;">&nbsp;</th>
														</tr>
													</thead>
												</table>
												<div class="div-wid" id="div-wid">
<%
		if ( recordList!=null) {
			if ( recordList.length == 0 && "1".equals(formBean.getSubmitFlag())){
%>
												<table border="1" class="data-grid"  style="width:1140px; height:120px;">
													<tr>
														<td colspan="6">データが存在しません。</td>
													</tr>
												</table>
<%
			}
%>
												<table  border="0" width="1140px" height="30px" class="data-grid">
<%
			for (int i=0; i<recordList.length; i++) {
				Mst6000Bean.Record record=recordList[i];
%>

													<tr style="background-color: <%=("true".equals(record.colorFlg))?"#FFFFFF":"" %>">
														<td class="TblField1 TxtCenter"style="<%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>">
																<!-- ２ページ目以降も連番で表示されるように計算 -->
																<%=(i+1)+((nowPageNo-1)*formBean.getLimit())%>
														</td>
														<td class="TblField2 TxtCenter"style="<%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>"><%=record.valId%></td>
														<td class="TblField3" style="<%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>"><%=record.value1%></td>
														<td class="TblField4" style="<%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>"><%=record.value2%></td>
														<td class="TblField5"style="<%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>"><%=record.value3%></td>
														<td class="TblField6 TxtCenter" style="background-color: #BBFFFF; <%=("1".equals(record.delDiv)? "color: red;" : "&nbsp")%>"><%=record.seq%></td>
														<td class="TblField7 TxtCenter" ><input type="button" value="変更" class="button" onclick="updateSerch('<%=record.valId %>','<%=formBean.getFindSysId() %>')" alt="変更"></td>
													</tr>

<%
			}
		}
%>
												</table>
												</div>
											</td>
										</tr>
									</table>
								</div>
							</div><!-- lc-in_under End -->

							<!-- ログ Start -->
							<!-- ログ End -->

						</div><!-- lc-out  -->
					</td>
				</tr>
			</table>

			<input type="hidden" name="cmd" value="cmd01">
			<input type="hidden" name="submitFlag" id="submitFlag" value="">
			<input type="hidden" id="nextPage" name="nextPage" value="">
			<input type="hidden" id="dataId1" name="dataId1" value="">
			<input type="hidden" id="dataId2" name="dataId2" value="">
			<input type="hidden" id="dataId3" name="dataId3" value="">

			<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::ページング START:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
			<input type="hidden" name="pageNo" value="<%= nowPageNo %>">
			<input type="hidden" name="selectPageNo" value="<%=formBean.getSelectPageNo()%>">
			<!-- :::::::::::::::::::::::::::::::::::::::::::::::ページング END:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->

			<!--警告 ポップアップ---------------------------------------------------------------------------- -->
			<div id="allbackgr" class="allbackgr" style="display:none;"></div>
			<div class="opAlertBtn" id = "opAlertBtn" style="display:none;" ></div>
			<div class="opAlertButton" id = "opAlertButton" style="display:none;" ></div>
			<div class="opAlertTop" id = "opAlertTop" style="display:none; font-size:22px;">　予備品管理システム　</div>
			<div class="opAlert" id = "opAlert" style="display:none;"></div>
			<!-- -------------------------------------------------------------------------------------------- -->

		</form>
	</body>
</html>
